<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script src="./js/jquery-3.3.1.min.js"></script>
  <title>Document</title>
  <style>
  #star::after {
    content: "";
    display: block;
    clear: both;
  }
  #star li{
    float: left;
    color: yellow;
    list-style: none;
    font-size: 50px;
  }

  </style>
</head>
<body>
  <ul id="star">
    <li>☆</li>
    <li>☆</li>
    <li>☆</li>
    <li>☆</li>
    <li>☆</li>
  </ul>
  <script>
    // 当鼠标移动到星星上时，该星星和之前的星星都变成★
    $("#star li").mouseover(function() {
      $(this).text("★").prevAll().text("★");
    })
    // 当鼠标移开时，变成☆
    $("#star").mouseout(function() {
      $(this).children().text("☆");
    })
  </script>
</body>
</html>